import 'package:enterprise_v6_app/app/components/common/custom_text_widget.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/data/entities/application/emergency/exercise_plan_entity.dart';

/// 应急演练通用样式
class DrillPlanCommonWidget {
  /// 基本信息
  static Widget getBasicInformationWidget(ExercisePlanEntity entity) {
    return Container(
      alignment: Alignment.topCenter,
      color: const Color(0xffffffff),
      padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 16.w),
      child: SingleChildScrollView(
        child: Column(
          children: [
            CustomTextWidget.getTextRowView(title: '计划名称', value: entity.exercisePlanName),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '演练类别', value: entity.exercisePlanClassName),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '演练类型', value: entity.exercisePlanTypeName),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '预案名称', value: entity.emergencyIdName),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '演练级别', value: entity.exercisePlanLevelName),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '编制人', value: entity.preparedBy),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '编制时间', value: entity.preparedDate),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '演练目的及要求', value: entity.purposeRequirement),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '演练地点', value: entity.exercisePlanAddress),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '预计完成时间', value: entity.expectedCompletionTime),
            AppGaps.vGap16,
            CustomTextWidget.getTextRowView(title: '演练场景', value: entity.exerciseScenario),
            AppGaps.vGap16,
            CustomTextWidget.getFileRowView(title: '演练方案', fileList: [entity.exercisePlanProgramme]),
            AppGaps.vGap16,
            CustomTextWidget.getFileRowView(title: '演练脚本', fileList: [entity.exercisePlanScript]),
          ],
        ),
      ),
    );
  }

  /// 获取状态图标
  Widget getStateView(int state) {
    String? stateText;
    Color? color;
    switch (state) {
      case 1:
        stateText = '待发起';
        color = const Color(0xFF00FFFF);
        break;
      case 2:
        stateText = '待审批';
        color = const Color(0xFFFFA500);
        break;
      case 3:
        stateText = '审批中';
        color = const Color(0xFFF1CC06);
        break;
      case 4:
        stateText = '通过';
        color = const Color(0xFF00FF00);
        break;
      case 5:
        stateText = '已驳回';
        color = const Color(0xFF800080);
        break;
      case 6:
        stateText = '待发布';
        color = const Color(0xffFD6B6B);
        break;
      case 7:
        stateText = '待开始';
        color = const Color(0xFF0000FF);
        break;
      case 8:
        stateText = '进行中';
        color = const Color(0xFF77DE79);
        break;
      case 9:
        stateText = '已结束';
        color = const Color(0xFF000000);
        break;
      case 10:
        stateText = '已废止';
        color = const Color(0xFF5B5B5E);
        break;
    }
    return Container(
      alignment: Alignment.center,
      height: 18.w,
      width: 52.w,
      decoration: BoxDecoration(
        color: color ?? Colors.white,
        borderRadius: BorderRadius.only(
          topRight: Radius.circular(20.w),
          topLeft: Radius.circular(20.w),
          bottomRight: Radius.circular(20.w),
        ),
      ),
      child: Text(
        stateText ?? '',
        style: TextStyle(
          fontSize: 10.sp,
          fontWeight: FontWeight.w400,
          color: Colors.white,
        ),
      ),
    );
  }

}
